// import { createStore, applyMiddleware } from 'redux'
// import thunk from 'redux-thunk'
// import reducer from './reducer'

// const store = createStore(reducer, applyMiddleware(thunk))

import { createStore, applyMiddleware } from 'redux'
import Immutable from 'immutable'

import createSagaMiddleware from 'redux-saga'
import sagas from './sagas'
// import thunk from 'redux-thunk'

import reducer from './reducer'

const sagaMiddleware = createSagaMiddleware()

const initialState = Immutable.Map()

// const store = createStore(reducer, initialState, applyMiddleware(thunk))
const store = createStore(reducer, initialState,  applyMiddleware(sagaMiddleware))

// console.log(store.getState())
// sagaMiddleware.run(sagas)

sagas.forEach(saga => sagaMiddleware.run(saga))

export default store